package site.luojie.common.service;

import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import site.luojie.common.vo.ResultVo;

/**
 * @author jie.luo
 * @since 2020/9/17
 */
@FeignClient(
        name = "code",
        fallback = CodeFeignService.CodeFeignServiceFallbackImpl.class,
        path = "/code"
)
public interface CodeFeignService {
    /**
     * 校验验证码
     */
    @PostMapping("/verifyCodeCheck")
    ResultVo<Boolean> verifyCodeCheck(@RequestParam(name = "email") String email,
                                      @RequestParam(name = "verifyCode") String verifyCode);

    @Component
    class CodeFeignServiceFallbackImpl implements CodeFeignService {

        @Override
        public ResultVo<Boolean> verifyCodeCheck(String email, String verifyCode) {
            return ResultVo.customData("000", "验证服务GG啦");
        }
    }

}
